Currently the right arrow key always increases the slider value,
even in RTL locales where the slider itself increases leftwards.
Fix that, so that the arrow keys always correspond to the
direction of the slider.
Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7963
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3500>
(cherry picked from commit
5309f747fad23ebc707870868016f0414776e59c)
vfunc_key_press_event(event) {
let key = event.get_key_symbol();
if (key === Clutter.KEY_Right || key === Clutter.KEY_Left) {
- let delta = key === Clutter.KEY_Right ? 0.1 : -0.1;
+ const rtl = this.get_text_direction() === Clutter.TextDirection.RTL;
+ const increaseKey = rtl ? Clutter.KEY_Left : Clutter.KEY_Right;
+ const delta = key === increaseKey ? 0.1 : -0.1;
this.value = Math.max(0, Math.min(this._value + delta, this._maxValue));
return Clutter.EVENT_STOP;
}